define("zui/mask",['zui/utils'],function(require,exports,module){

		var zUtil=require("zui/utils");
		var LoadMask={
				el:null,
				delaytime:null,
				msg:"<span>{title}</span>",
				loadingMsg:"<i class='ui-loading'></i>",

				show:function(){
					var _self=this;
					_self.el="loading_"+new Date().getTime();
					//alert("<div id='"+_self.el+"'></div>")
					$("body").append("<div id='"+_self.el+"'></div>");

					$("#"+_self.el).dialog({
				        closeBtn:false,
				        title:"",
				        content:formatMessage(_self.loadingMsg,{title:_self.msg})

				    });

					_self.delaytime=setTimeout(function(){
						$("#"+_self.el).dialog("open").dialog("refresh");
					},20);
				},
				close:function(){
					var _self=this;
					$("#"+_self.el).dialog("destroy");
					$("#"+_self.el).remove();
					clearTimeout(_self.delaytime);
				}

		}

		 function formatMessage(msg,value){
		    return zUtil.substitute(msg,value);
		  }

		return LoadMask;






})